import request from '@/utils/request'

// 查询项目角色-菜单中间列表
export function listMenu(query) {
  return request({
    url: '/system/menu/list',
    method: 'get',
    params: query
  })
}

// 查询项目角色-菜单中间详细
export function getMenu(projectRoleId) {
  return request({
    url: '/system/menu/' + projectRoleId,
    method: 'get'
  })
}

// 新增项目角色-菜单中间
export function addMenu(data) {
  return request({
    url: '/system/menu',
    method: 'post',
    data: data
  })
}

// 修改项目角色-菜单中间
export function updateMenu(data) {
  return request({
    url: '/system/menu',
    method: 'put',
    data: data
  })
}

// 删除项目角色-菜单中间
export function delMenu(projectRoleId) {
  return request({
    url: '/system/menu/' + projectRoleId,
    method: 'delete'
  })
}

// export function projectRoleMenuTreeSelect(projectRoleId) {
//   return request({
//     url: '/business/projectRole/menu/projectRoleMenuTreeSelect/' + projectRoleId,
//     method: 'get'
//   })
// }

export function projectRoleMenuTreeSelect(projectRoleId, projectId) {
  return request({
    url: `/business/projectRole/menu/projectRoleMenuTreeSelect2/${projectRoleId}/${projectId}`,
    method: 'get'
  })
}

export function updateProjectRoleMenu(data) {
  return request({
    url: '/business/projectRole/menu/updateProjectRoleMenu',
    method: 'put',
    data: data
  })
}
